Integrand size = 21, antiderivative size = 59 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {2 a b \text {arctanh}(\sin (c+d x))}{d}-\frac {\left (a^2+b^2\right ) \cot (c+d x)}{d}-\frac {2 a b \csc (c+d x)}{d}+\frac {b^2 \tan (c+d x)}{d} \]
Leaf count is larger than twice the leaf count of optimal. \(138\) vs. \(2(59)=118\).
Time = 1.14 (sec) , antiderivative size = 138, normalized size of antiderivative = 2.34 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {\csc ^3\left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {1}{2} (c+d x)\right ) \left (4 a b \cos (c+d x)+\left (a^2+2 b^2\right ) \cos (2 (c+d x))+a \left (a+2 b \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right ) \sin (2 (c+d x))\right )\right )}{4 d \left (-1+\cot ^2\left (\frac {1}{2} (c+d x)\right )\right )} \]
-1/4*(Csc[(c + d*x)/2]^3*Sec[(c + d*x)/2]*(4*a*b*Cos[c + d*x] + (a^2 + 2*b ^2)*Cos[2*(c + d*x)] + a*(a + 2*b*(Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2] ] - Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]])*Sin[2*(c + d*x)])))/(d*(-1 + Cot[(c + d*x)/2]^2))
Time = 0.76 (sec) , antiderivative size = 54, normalized size of antiderivative = 0.92, number of steps used = 14, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.619, Rules used = {3042, 4360, 3042, 3390, 25, 3042, 3101, 25, 262, 219, 4889, 244, 2009}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \csc ^2(c+d x) (a+b \sec (c+d x))^2 \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\left (a-b \csc \left (c+d x-\frac {\pi }{2}\right )\right )^2}{\cos \left (c+d x-\frac {\pi }{2}\right )^2}dx\) |
\(\Big \downarrow \) 4360 |
\(\displaystyle \int \csc ^2(c+d x) \sec ^2(c+d x) (-a \cos (c+d x)-b)^2dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\left (a \sin \left (c+d x-\frac {\pi }{2}\right )-b\right )^2}{\sin \left (c+d x-\frac {\pi }{2}\right )^2 \cos \left (c+d x-\frac {\pi }{2}\right )^2}dx\) |
\(\Big \downarrow \) 3390 |
\(\displaystyle \int \left (b^2+a^2 \cos ^2(c+d x)\right ) \csc ^2(c+d x) \sec ^2(c+d x)dx-2 a b \int -\csc ^2(c+d x) \sec (c+d x)dx\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \int \left (b^2+a^2 \cos ^2(c+d x)\right ) \csc ^2(c+d x) \sec ^2(c+d x)dx+2 a b \int \csc ^2(c+d x) \sec (c+d x)dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^2}dx+2 a b \int \csc (c+d x)^2 \sec (c+d x)dx\) |
\(\Big \downarrow \) 3101 |
\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^2}dx-\frac {2 a b \int -\frac {\csc ^2(c+d x)}{1-\csc ^2(c+d x)}d\csc (c+d x)}{d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^2}dx+\frac {2 a b \int \frac {\csc ^2(c+d x)}{1-\csc ^2(c+d x)}d\csc (c+d x)}{d}\) |
\(\Big \downarrow \) 262 |
\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^2}dx-\frac {2 a b \left (\csc (c+d x)-\int \frac {1}{1-\csc ^2(c+d x)}d\csc (c+d x)\right )}{d}\) |
\(\Big \downarrow \) 219 |
\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^2}dx-\frac {2 a b (\csc (c+d x)-\text {arctanh}(\csc (c+d x)))}{d}\) |
\(\Big \downarrow \) 4889 |
\(\displaystyle \frac {\int \cot ^2(c+d x) \left (a^2+b^2+b^2 \tan ^2(c+d x)\right )d\tan (c+d x)}{d}-\frac {2 a b (\csc (c+d x)-\text {arctanh}(\csc (c+d x)))}{d}\) |
\(\Big \downarrow \) 244 |
\(\displaystyle \frac {\int \left (b^2+\left (a^2+b^2\right ) \cot ^2(c+d x)\right )d\tan (c+d x)}{d}-\frac {2 a b (\csc (c+d x)-\text {arctanh}(\csc (c+d x)))}{d}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {b^2 \tan (c+d x)-\left (a^2+b^2\right ) \cot (c+d x)}{d}-\frac {2 a b (\csc (c+d x)-\text {arctanh}(\csc (c+d x)))}{d}\) |
(-2*a*b*(-ArcTanh[Csc[c + d*x]] + Csc[c + d*x]))/d + (-((a^2 + b^2)*Cot[c + d*x]) + b^2*Tan[c + d*x])/d
3.2.82.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt Q[a, 0] || LtQ[b, 0])
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[Expand Integrand[(c*x)^m*(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, m}, x] && IGtQ[p , 0]
Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[c*(c*x) ^(m - 1)*((a + b*x^2)^(p + 1)/(b*(m + 2*p + 1))), x] - Simp[a*c^2*((m - 1)/ (b*(m + 2*p + 1))) Int[(c*x)^(m - 2)*(a + b*x^2)^p, x], x] /; FreeQ[{a, b , c, p}, x] && GtQ[m, 2 - 1] && NeQ[m + 2*p + 1, 0] && IntBinomialQ[a, b, c , 2, m, p, x]
Int[(csc[(e_.) + (f_.)*(x_)]*(a_.))^(m_)*sec[(e_.) + (f_.)*(x_)]^(n_.), x_S ymbol] :> Simp[-(f*a^n)^(-1) Subst[Int[x^(m + n - 1)/(-1 + x^2/a^2)^((n + 1)/2), x], x, a*Csc[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2] && !(IntegerQ[(m + 1)/2] && LtQ[0, m, n])
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n _)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[2*a*(b/d) Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n + 1), x], x] + Int[(g*Cos[e + f* x])^p*(d*Sin[e + f*x])^n*(a^2 + b^2*Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, e, f, g, n, p}, x] && NeQ[a^2 - b^2, 0]
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Int[(g*Cos[e + f*x])^p*((b + a*Sin[e + f*x])^m/Si n[e + f*x]^m), x] /; FreeQ[{a, b, e, f, g, p}, x] && IntegerQ[m]
Int[u_, x_Symbol] :> With[{v = FunctionOfTrig[u, x]}, With[{d = FreeFactors [Tan[v], x]}, Simp[d/Coefficient[v, x, 1] Subst[Int[SubstFor[1/(1 + d^2*x ^2), Tan[v]/d, u, x], x], x, Tan[v]/d], x]] /; !FalseQ[v] && FunctionOfQ[N onfreeFactors[Tan[v], x], u, x]] /; InverseFunctionFreeQ[u, x] && !MatchQ[ u, (v_.)*((c_.)*tan[w_]^(n_.)*tan[z_]^(n_.))^(p_.) /; FreeQ[{c, p}, x] && I ntegerQ[n] && LinearQ[w, x] && EqQ[z, 2*w]]
Time = 1.00 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.29
method | result | size |
derivativedivides | \(\frac {-a^{2} \cot \left (d x +c \right )+2 a b \left (-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )}{d}\) | \(76\) |
default | \(\frac {-a^{2} \cot \left (d x +c \right )+2 a b \left (-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )}{d}\) | \(76\) |
parallelrisch | \(\frac {-8 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \cos \left (d x +c \right )+8 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \cos \left (d x +c \right )-\left (\left (a^{2}+2 b^{2}\right ) \cos \left (2 d x +2 c \right )+a \left (a -4 b \right )\right ) \sec \left (\frac {d x}{2}+\frac {c}{2}\right ) \csc \left (\frac {d x}{2}+\frac {c}{2}\right )-8 a b \cot \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d \cos \left (d x +c \right )}\) | \(119\) |
risch | \(-\frac {2 i \left (2 a b \,{\mathrm e}^{3 i \left (d x +c \right )}+a^{2} {\mathrm e}^{2 i \left (d x +c \right )}+2 a b \,{\mathrm e}^{i \left (d x +c \right )}+a^{2}+2 b^{2}\right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}\) | \(122\) |
norman | \(\frac {\frac {a^{2}+2 a b +b^{2}}{2 d}-\frac {\left (a^{2}+3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{d}+\frac {\left (a^{2}-2 a b +b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{2 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}-\frac {2 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}+\frac {2 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) | \(136\) |
1/d*(-a^2*cot(d*x+c)+2*a*b*(-1/sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))+b^2*( 1/sin(d*x+c)/cos(d*x+c)-2*cot(d*x+c)))
Time = 0.27 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.76 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {a b \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) - a b \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) - 2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} + 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}{d \cos \left (d x + c\right ) \sin \left (d x + c\right )} \]
(a*b*cos(d*x + c)*log(sin(d*x + c) + 1)*sin(d*x + c) - a*b*cos(d*x + c)*lo g(-sin(d*x + c) + 1)*sin(d*x + c) - 2*a*b*cos(d*x + c) - (a^2 + 2*b^2)*cos (d*x + c)^2 + b^2)/(d*cos(d*x + c)*sin(d*x + c))
\[ \int \csc ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=\int \left (a + b \sec {\left (c + d x \right )}\right )^{2} \csc ^{2}{\left (c + d x \right )}\, dx \]
Time = 0.20 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.24 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {a b {\left (\frac {2}{\sin \left (d x + c\right )} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + b^{2} {\left (\frac {1}{\tan \left (d x + c\right )} - \tan \left (d x + c\right )\right )} + \frac {a^{2}}{\tan \left (d x + c\right )}}{d} \]
-(a*b*(2/sin(d*x + c) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) + b ^2*(1/tan(d*x + c) - tan(d*x + c)) + a^2/tan(d*x + c))/d
Leaf count of result is larger than twice the leaf count of optimal. 167 vs. \(2 (59) = 118\).
Time = 0.33 (sec) , antiderivative size = 167, normalized size of antiderivative = 2.83 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {4 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 4 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 5 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{2} - 2 \, a b - b^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \]
1/2*(4*a*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 4*a*b*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + a^2*tan(1/2*d*x + 1/2*c) - 2*a*b*tan(1/2*d*x + 1/2*c) + b ^2*tan(1/2*d*x + 1/2*c) - (a^2*tan(1/2*d*x + 1/2*c)^2 + 2*a*b*tan(1/2*d*x + 1/2*c)^2 + 5*b^2*tan(1/2*d*x + 1/2*c)^2 - a^2 - 2*a*b - b^2)/(tan(1/2*d* x + 1/2*c)^3 - tan(1/2*d*x + 1/2*c)))/d
Time = 14.58 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.83 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (a-b\right )}^2}{2\,d}-\frac {2\,a\,b+a^2+b^2-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (a^2+2\,a\,b+5\,b^2\right )}{d\,\left (2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\right )}+\frac {4\,a\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \]